<%@ page isELIgnored="false" language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<c:set var="_path" value="${pageContext.request.contextPath}"></c:set>
<form id="select_queryForm" style="margin:10;text-align: center;">
	<table width="100%">
		<tr>
			<td>商户名称(简)：</td>
			<td>
				<input name="namesimp" style="width: 100"/>
			</td>
			<td>负责人移动电话：</td>
			<td>
				<input name="telephone" style="width: 100">
			</td>
			<td align="center"><a href="javascript:void(0);" onClick="doSearchAab()" class="easyui-linkbutton" iconCls="icon-search">查询</a></td>
		</tr>
	</table>
	<div id="select_aabTable"></div>
</form>
<script>
jQuery(function($){
	$('#select_aabTable').datagrid({
		title:'商户列表',//标题
		method:'post',
		iconCls:'icon-edit',//图标
		singleSelect:true,//多选
		height:300, //高度
		fitColumns: true,//自动调整各列，用了这个属性，下面各列的宽度值就只是一个比例。
		striped: true,//奇偶行颜色不同
		collapsible:false,//可折叠
		url:"aab/queryList", //数据来源
		sortName: 'id', //排序的列
		sortOrder: 'desc', //倒序
		remoteSort: true, //服务器端排序
		idField:'id', //主键字段
		queryParams:{}, //查询条件
		pagination:true, //显示分页
		rownumbers:true, //显示行号
		columns:[[
			{field:'id',title:'商户ID',width:20,sortable:true},
			{field:'namesimp',title:'商户名称(简)',width:20,sortable:true},
			{field:'nameall',title:'商户名称(全)',width:20,sortable:true},
			{field:'selltax',title:'手续费率',width:20,sortable:true},
			{field:'creatdate',title:'登记日期',width:20,sortable:true},
			{field:'telephone',title:'负责人移动电话',width:20,sortable:true}
		]],
		onLoadSuccess:function(){
			$('#select_aabTable').datagrid('clearSelections'); //一定要加上这一句，要不然datagrid会记住之前的选择状态，删除时会出问题
		},
		onDblClickRow : function(rowIndex,rowData){
			$('#shopid').val(rowData.id);
			$('#shop_nameall').val(rowData.nameall);
			$('#shop_namesimp').html(rowData.namesimp);
			$('#shop_telephone').html(rowData.telephone);
			$('#shop_address').html(rowData.address);
			$('#_aabSelect').window('close');
		}
	});
});
//表格查询
function doSearchAab(){
	var params = $('#select_aabTable').datagrid('options').queryParams;//先取得 datagrid的查询参数
	var fields =$('#queryForm').serializeArray();//自动序列化表单元素为JSON对象
	$.each( fields, function(i, field){
		params[field.name] = field.value;//设置查询参数
	}); 
	$('#select_aabTable').datagrid('reload');
}
//清空查询条件
function clearAabForm(){
	$('#select_queryForm').form('clear');
	doSearchAab();
}
</script>